import Taro, { Component } from '@tarojs/taro'
import { View, Text, Swiper, SwiperItem, Image, ScrollView } from '@tarojs/components'
import { parsePrice } from '@utils/utils'
import prodCol from '@assets/icon/prod-col.png'
import prodColRed from '@assets/icon/prod-col-red.png'
import './index.scss'

export default class ProdItemInfo extends Taro.Component {
    static defaultProps = {
        prodName: "",
        brief: "",
        defaultSku: {}
    }
    render() {
        const { prodName, brief, defaultSku } = this.props
        return (
            // <!-- 商品信息 -->
            //   <!-- <block wx:for="{{imgs}}" wx:key=''> -->
            <View className='prod-info'>
                <View className="tit-wrap">
                    <View className="prod-tit">{prodName}</View>
                    <View className="col" bindtap='addOrCannelCollection'>
                        {!this.state.isCollection &&
                            <Image className='image' src={prodCol} />
                        }
                        {this.state.isCollection &&
                            <Image className='image' src={prodColRed} />
                        }
                        收藏
                    </View>
                </View>
                <View className="sales-p">{brief}</View>
                <View className="prod-price">
                    <Text className="price">￥<Text className="price-num">{parsePrice(defaultSku.price)[0]}</Text>.{parsePrice(defaultSku.price)[1]}</Text>
                    <Text className="sales"></Text>
                </View>
                {/* <!-- <button className="share-icon" open-type="share">
         <Image src='../../Images/icon/share.png'></Image>
         <View className="share-Text">分享</View>
       </button> --> */}
            </View>
            //   <!-- </block> -->
            //   <!-- end 商品信息 -->
        )
    }
}